import {
  getMovieList
} from '../../api/index'
import store from '../store'
import {
  GETMOVIELIST
} from '../constants/movie_const'

export const getMovieListAction = (data) => {
  // 返回的是对象交给 store 处理，函数交给 thunk 处理
  return async () => {
    const {data} = await getMovieList()
    store.dispatch({
      type: GETMOVIELIST,
      data: data.list
    })
  }
}